package edu.colorado.core;

import java.io.Serializable;

public class GameStateStack implements Serializable
{
    private static final long serialVersionUID = 8842844210628786042L;

    GameState gameStates[];
    Integer depth;

    GameStateStack()
    {
        depth = 0;
        gameStates = new GameState[21];
    }

    void push(GameState newState)
    {
        gameStates[depth] = newState;
    }

    GameState pop()
    {
        return gameStates[--depth];
    }

    GameState top()
    {
        return gameStates[depth++];
    }

    Integer size()
    {
        return depth;
    }
}
